﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace TinyCinema.UI.Pages.Schedule
{
    /// <summary>
    /// Interaction logic for Deal.xaml
    /// </summary>
    public partial class Deal : Page
    {
        public static DependencyProperty ContentFrameSourceProperty = DependencyProperty.Register("pagContentFrameSource", typeof(Page), typeof(Deal));
        public Page pagContentFrameSource
        {
            get { return (Page)GetValue(ContentFrameSourceProperty); }
            set { SetValue(ContentFrameSourceProperty, value); }
        }
        public Deal()
        {
            InitializeComponent();
        }

        public static _Deal.NewDeal pagNewDeal = new _Deal.NewDeal();
        public static _Deal.FromBookedTicket pagFromBookedTicket = new _Deal.FromBookedTicket();
        Button btnPreTab;

        private void TabControl(object sender, RoutedEventArgs e)
        {
            var btn = sender as Button;
            switch(btn.Uid)
            {
                case "New": pagContentFrameSource = pagNewDeal;
                    break;
                case "FromBookedTicket": pagContentFrameSource = pagFromBookedTicket;
                    break;
            }
            try
            {
                btnPreTab.IsEnabled = true;                
            }
            catch { }
            btnPreTab = btn;
            btn.IsEnabled = false;
        }

        private void TabControl(object sender, EventArgs e)
        {
            TabControl(sender, new RoutedEventArgs());
        }
    }
}
